package org.yuanzheng.transformation

import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment

/**
 * @author yuanzheng
 * @date 2020/6/17-13:38
 */
object TestUnion {
  def main(args: Array[String]): Unit = {
    val streamEnv: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
    streamEnv.setParallelism(1)
    import org.apache.flink.streaming.api.scala._
    val stream1: DataStream[(String, Int)] = streamEnv.fromElements(("a", 1), ("b", 2))
    val stream2: DataStream[(String, Int)] = streamEnv.fromElements(("c", 3), ("d", 4))
    val stream3: DataStream[(String, Int)] = streamEnv.fromElements(("e", 5), ("f", 6))
    val stream: DataStream[(String, Int)] = stream1.union(stream2, stream3)
    stream.print()
    streamEnv.execute()
  }
}
